﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CNEMC_WPF
{
    /// <summary>
    /// 代表一个监测站点
    /// </summary>
    public class StationInfo
    {
        /// <summary>
        /// 站点编码
        /// </summary>
        [DisplayName("站点编码")]
        public string Code { get; set; }
        /// <summary>
        /// 站点名称
        /// </summary>
        [DisplayName("站点名称")]
        public string Name { get; set; }
        /// <summary>
        /// 所在城市
        /// </summary>
        [DisplayName("所在城市")]
        public string City { get; set; }
        /// <summary>
        /// 纬度坐标
        /// </summary>
        [DisplayName("纬度坐标")]
        public double Latitude { get; set; }
        /// <summary>
        /// 经度坐标
        /// </summary>
        [DisplayName("经度坐标")]
        public double Longitude { get; set; }

        /// <summary>
        /// 获取类型属性的描述文本
        /// </summary>
        /// <param name="PropertyName">属性名</param>
        /// <returns></returns>
        public static string GetPropertyDescription(string PropertyName)
        {
            //反射获取属性的特性
            return (typeof(StationInfo).GetProperty(PropertyName).GetCustomAttributes(typeof(DisplayNameAttribute), false)[0] as DisplayNameAttribute).DisplayName;
        }
    }
}
